package com.da.javatest.leetCode;

import java.util.Arrays;

/**
 * @author chenlida
 * @date 2019/1/17 10:34
 * @description
 */
public class Code506 {
    public String[] findRelativeRanks(int[] nums) {
        String[] result = new String[nums.length];
        int[] temp = new int[nums.length];
        System.arraycopy(nums, 0, temp, 0, nums.length);
        Arrays.sort(temp);
        for (int i = temp.length - 1; i >= 0; i--) {
            for (int j = 0; j < nums.length; j++) {
                if (temp[i] == nums[j]) {
                    if (temp.length - i == 1) {
                        result[j] = "Gold Medal";
                    } else if (temp.length - i == 2) {
                        result[j] = "Silver Medal";
                    } else if (temp.length - i == 3) {
                        result[j] = "Bronze Medal";
                    } else {
                        result[j] = (temp.length - i) + "";
                    }
                    break;
                }
            }
        }
        return result;
    }
}
